//
//  SearchViewController.h
//  MSDemo
//
//  Created by ms on 2023/2/20.
//

#import "MSViewController.h"

NS_ASSUME_NONNULL_BEGIN

/** 搜索 */
@interface SearchViewController : MSViewController

/** 1 店铺 */
@property (nonatomic, copy) NSString *source;
@property (nonatomic, copy) NSString *placeholder;

@end

/** 搜索资源view */
@interface SCSearchSourceView : MSView

/** 选中下标 */
@property (nonatomic, assign) NSInteger selectedIdx;
/** 搜索渠道数量 */
@property (nonatomic, copy) NSInteger(^numberOfItemsInSourceView)(SCSearchSourceView *view);
/** 搜索渠道名 */
@property (nonatomic, copy) NSString *(^titleOfItemsInSourceView)(SCSearchSourceView *view, NSInteger idx);
/** 搜索渠道颜色，默认0xEE3234 */
@property (nonatomic, copy) UIColor *(^titleColorOfItemsInSourceView)(SCSearchSourceView *view, NSInteger idx);
/** 选中搜索渠道颜色，默认0x333333 */
@property (nonatomic, copy) UIColor *(^selectedTitleColorOfItemsInSourceView)(SCSearchSourceView *view, NSInteger idx);
/** 搜索渠道字体，默认14号 */
@property (nonatomic, copy) UIFont *(^titleFontOfItemsInSourceView)(SCSearchSourceView *view, NSInteger idx);
/** 选中搜索渠道字体，默认14号 */
@property (nonatomic, copy) UIFont *(^selectedTitleFontOfItemsInSourceView)(SCSearchSourceView *view, NSInteger idx);
/** 点击搜索渠道 */
@property (nonatomic, copy) void(^didSelectedItem)(SCSearchSourceView *view, NSInteger idx);
/** 隐藏回调 */
@property (nonatomic, copy) void(^sourceViewIsHidden)(SCSearchSourceView *view);

- (void)reloadData;

@end


typedef NS_ENUM(NSUInteger, SCSortStatus) {
    SCSortStatusDefault,///< 综合
    SCSortStatusSalesAscending,///< 销量升序
    SCSortStatusSalesDescending,///< 销量降序
    SCSortStatusPriceAscending,///< 价格升序
    SCSortStatusPriceDescending,///< 价格降序
    SCSortStatusSelfSupport,///< 自营
};
/** 排序(综合、销量降序、价格升序、价格降序) + 自营过滤  */
@interface SCSearchGoodsSortView : MSView

/** 排序类型 */
@property (nonatomic, assign) SCSortStatus sortStatus;
/** 按钮更新回调 */
@property (nonatomic, copy) void(^completeBlock)(SCSortStatus sortStatus);

@end

/** 综合排序 + 自营过滤  */
@interface SCSearchStoreSortView : MSView

/** 排序类型 */
@property (nonatomic, assign) SCSortStatus sortStatus;
/** 按钮更新回调 */
@property (nonatomic, copy) void(^completeBlock)(SCSortStatus sortStatus);

@end

@interface SCSearchSearchBarLeftView : MSView

/** @{@"title" : @"商品", @"source" : @"0"}， source=1 店铺 */
@property (nonatomic, copy) NSDictionary *sourceInfo;
/** 关键词 */
@property (nonatomic, copy) NSString *text;
@property (nonatomic, assign) BOOL selectingTypeButton;
@property (nonatomic, assign) BOOL showTypeButton;
@property (nonatomic, assign) BOOL showTextView;
/** 点击了【店铺/商品】按钮，source=1 店铺*/
@property (nonatomic, copy) void(^didSelectedTypeButtonBlock)(SCSearchSearchBarLeftView *view, NSDictionary *sourceInfo);
/** 点击了【搜索文字】按钮*/
@property (nonatomic, copy) BOOL(^didSelectedTextLabelBlock)(SCSearchSearchBarLeftView *view, NSDictionary *sourceInfo, NSString *text);
/** 点击了【X】按钮*/
@property (nonatomic, copy) void(^didSelectedClearButtonBlock)(SCSearchSearchBarLeftView *view, NSDictionary *sourceInfo);

@end

NS_ASSUME_NONNULL_END
